<!doctype html>
<html class="no-js" lang="">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title>sup-mimi-program-server documentation</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="icon" type="image/x-icon" href="../images/favicon.ico">
	   <link rel="stylesheet" href="../styles/style.css">
        <link rel="stylesheet" href="../styles/dark.css">
        <link rel="stylesheet" href="../styles/postmark.css">
    </head>
    <body>
          <script>
               // Blocking script to avaoid flickering dark mode
               // Dark mode toggle button
               var useDark = window.matchMedia('(prefers-color-scheme: dark)');
               var darkModeState = useDark.matches;
               var $darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
               var $darkModeToggles = document.querySelectorAll('.dark-mode-switch');
               var darkModeStateLocal = localStorage.getItem('compodoc_darkmode-state');

               function checkToggle(check) {
                    for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
                         $darkModeToggleSwitchers[i].checked = check;
                    }
               }

               function toggleDarkMode(state) {
                    if (window.localStorage) {
                         localStorage.setItem('compodoc_darkmode-state', state);
                    }

                    checkToggle(state);

                    const hasClass = document.body.classList.contains('dark');

                    if (state) {
                         for (var i = 0; i < $darkModeToggles.length; i++) {
                              $darkModeToggles[i].classList.add('dark');
                         }
                         if (!hasClass) {
                              document.body.classList.add('dark');
                         }
                    } else {
                         for (var i = 0; i < $darkModeToggles.length; i++) {
                              $darkModeToggles[i].classList.remove('dark');
                         }
                         if (hasClass) {
                              document.body.classList.remove('dark');
                         }
                    }
               }

               useDark.addEventListener('change', function (evt) {
                    toggleDarkMode(evt.matches);
               });
               if (darkModeStateLocal) {
                    darkModeState = darkModeStateLocal === 'true';
               }
               toggleDarkMode(darkModeState);

               if ($darkModeToggles.length > 0) {
                    for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
                         $darkModeToggleSwitchers[i].addEventListener('change', function (event) {
                              darkModeState = !darkModeState;
                              toggleDarkMode(darkModeState);
                         });
                    }
               }
          </script>

        <div class="navbar navbar-default navbar-fixed-top d-block d-sm-none">
            <a href="../" class="navbar-brand">sup-mimi-program-server documentation</a>
            <button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
        </div>

        <div class="xs-menu menu" id="mobile-menu">
                <div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div>            <compodoc-menu></compodoc-menu>
        </div>

        <div class="container-fluid main">
           <div class="row main">
               <div class="hidden-xs menu">
                   <compodoc-menu mode="normal"></compodoc-menu>
               </div>
               <!-- START CONTENT -->
               <div class="content miscellaneous-variables">
                   <div class="content-data">


















<ol class="breadcrumb">
  <li class="breadcrumb-item">Miscellaneous</li>
  <li class="breadcrumb-item">Variables</li>
</ol>

<section data-compodoc="block-index">
    <h3 id="index">Index</h3>
    <table class="table table-sm table-bordered index-table">
        <tbody>
            <tr>
                <td class="col-md-4">
                    <ul class="index-list">
                        <li>
                            <a href="#allMethods" title="utils/mongo-crud/crud.decorator.ts" ><b>allMethods</b>&nbsp;&nbsp;&nbsp;(utils/.../crud.decorator.ts)</a>
                        </li>
                        <li>
                            <a href="#Crud" title="utils/mongo-crud/crud.decorator.ts" ><b>Crud</b>&nbsp;&nbsp;&nbsp;(utils/.../crud.decorator.ts)</a>
                        </li>
                        <li>
                            <a href="#CRUD_ROUTES" title="utils/mongo-crud/crud.decorator.ts" ><b>CRUD_ROUTES</b>&nbsp;&nbsp;&nbsp;(utils/.../crud.decorator.ts)</a>
                        </li>
                        <li>
                            <a href="#CrudQuery" title="utils/mongo-crud/crud-query.decorator.ts" ><b>CrudQuery</b>&nbsp;&nbsp;&nbsp;(utils/.../crud-query.decorator.ts)</a>
                        </li>
                        <li>
                            <a href="#defaultPaginate" title="utils/mongo-crud/crud-config.ts" ><b>defaultPaginate</b>&nbsp;&nbsp;&nbsp;(utils/.../crud-config.ts)</a>
                        </li>
                        <li>
                            <a href="#getMongoQueryParams" title="utils/mongo-crud/index.ts" ><b>getMongoQueryParams</b>&nbsp;&nbsp;&nbsp;(utils/.../index.ts)</a>
                        </li>
                        <li>
                            <a href="#isExpiredToUpdatedAtISOS" title="utils/common/index.ts" ><b>isExpiredToUpdatedAtISOS</b>&nbsp;&nbsp;&nbsp;(utils/.../index.ts)</a>
                        </li>
                        <li>
                            <a href="#isQueryAll" title="utils/mongo-crud/index.ts" ><b>isQueryAll</b>&nbsp;&nbsp;&nbsp;(utils/.../index.ts)</a>
                        </li>
                        <li>
                            <a href="#models" title="libs/db/src/db.module.ts" ><b>models</b>&nbsp;&nbsp;&nbsp;(libs/.../db.module.ts)</a>
                        </li>
                        <li>
                            <a href="#temp_test_content" title="src/feishu/store.ts" ><b>temp_test_content</b>&nbsp;&nbsp;&nbsp;(src/.../store.ts)</a>
                        </li>
                    </ul>
                </td>
            </tr>
        </tbody>
    </table>
</section>

    <h3>utils/mongo-crud/crud.decorator.ts</h3>
    <section data-compodoc="block-properties">
    <h3></h3>    <table class="table table-sm table-bordered">
        <tbody>
            <tr>
                <td class="col-md-4">
                    <a name="allMethods"></a>
                    <span class="name">
                        <span ><b>allMethods</b></span>
                        <a href="#allMethods"><span class="icon ion-ios-link"></span></a>
                    </span>
                </td>
            </tr>
                <tr>
                    <td class="col-md-4">
                        <i>Default value : </i><code>Object.values(CRUD_ROUTES)</code>
                    </td>
                </tr>


        </tbody>
    </table>
    <table class="table table-sm table-bordered">
        <tbody>
            <tr>
                <td class="col-md-4">
                    <a name="Crud"></a>
                    <span class="name">
                        <span ><b>Crud</b></span>
                        <a href="#Crud"><span class="icon ion-ios-link"></span></a>
                    </span>
                </td>
            </tr>
                <tr>
                    <td class="col-md-4">
                        <i>Default value : </i><code>(options: CrudOptionsWithModel) &#x3D;&gt; {
  options &#x3D; merge({}, CrudConfig.options, options);
  return (target) &#x3D;&gt; {
    const Controller &#x3D; target;
    const controller &#x3D; target.prototype;
    const crudController &#x3D; new CrudController(options.model);

    controller.crudOptions &#x3D; options;
    const methods &#x3D; allMethods.filter(
      (v) &#x3D;&gt; get(options, &#x60;routes.${v}&#x60;) !&#x3D;&#x3D; false,
    );
    for (let method of methods) {
      if (controller[method]) {
        continue;
      }

      controller[method] &#x3D; function test(...args) {
        return crudController[method].apply(this, args);
      };
      Object.defineProperty(controller[method], &#x27;name&#x27;, {
        value: method,
      });
      // clone instance decorators
      cloneDecorators(crudController, controller);
      cloneDecorators(crudController[method], controller[method]);
      // clone instance method decorators
      clonePropDecorators(crudController, controller, method);
      // clone class &quot;method&quot; decorators
      clonePropDecorators(CrudController, Controller, method);

      // get exists param types
      const types: [] &#x3D; Reflect.getMetadata(
        PARAMTYPES_METADATA,
        controller,
        method,
      );

      Reflect.decorate(
        [
          // replace fake dto to real dto
          Reflect.metadata(
            PARAMTYPES_METADATA,
            types.map((v: any) &#x3D;&gt; {
              if (get(v, &#x27;name&#x27;) &#x3D;&#x3D;&#x3D; CrudPlaceholderDto.name) {
                return get(options, &#x60;routes.${method}.dto&#x60;, options.model);
              }
              return v;
            }),
          ),
          ...get(options, &#x60;routes.${method}.decorators&#x60;, []),
        ],
        controller,
        method,
        Object.getOwnPropertyDescriptor(controller, method),
      );
    }
  };
}</code>
                    </td>
                </tr>


        </tbody>
    </table>
    <table class="table table-sm table-bordered">
        <tbody>
            <tr>
                <td class="col-md-4">
                    <a name="CRUD_ROUTES"></a>
                    <span class="name">
                        <span ><b>CRUD_ROUTES</b></span>
                        <a href="#CRUD_ROUTES"><span class="icon ion-ios-link"></span></a>
                    </span>
                </td>
            </tr>
                <tr>
                    <td class="col-md-4">
                        <i>Type : </i>        <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/object" target="_blank" >object</a></code>

                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                        <i>Default value : </i><code>{
  find: &#x27;find&#x27;,
  findOne: &#x27;findOne&#x27;,
  create: &#x27;create&#x27;,
  update: &#x27;update&#x27;,
  delete: &#x27;delete&#x27;,
}</code>
                    </td>
                </tr>


        </tbody>
    </table>
</section>
    <h3>utils/mongo-crud/crud-query.decorator.ts</h3>
    <section data-compodoc="block-properties">
    <h3></h3>    <table class="table table-sm table-bordered">
        <tbody>
            <tr>
                <td class="col-md-4">
                    <a name="CrudQuery"></a>
                    <span class="name">
                        <span ><b>CrudQuery</b></span>
                        <a href="#CrudQuery"><span class="icon ion-ios-link"></span></a>
                    </span>
                </td>
            </tr>
                <tr>
                    <td class="col-md-4">
                        <i>Default value : </i><code>createParamDecorator(
  (data: unknown, ctx: ExecutionContext) &#x3D;&gt; {
    const req: Request &#x3D; ctx.switchToHttp().getRequest();
    try {
      console.log(&#x27;CrudQuery params111&#x27;);
      const params &#x3D; req?.body || {};
      console.log(&#x27;CrudQuery params&#x27;, params);

      let [page, limit] &#x3D; get(params, &#x27;requestBase.page&#x27;, &#x27;1-10&#x27;)
        ?.split(&#x27;-&#x27;)
        .map((item) &#x3D;&gt; parseInt(item)) ?? [1, 10];
      const where &#x3D; get(params, &#x27;data.where&#x27;, {});
      let skip &#x3D; get(params, &#x27;requestBase.skip&#x27;, 0);
      const populate &#x3D; get(params, &#x27;requestBase.populate&#x27;, undefined);
      const sort &#x3D; get(params, &#x27;requestBase.sort&#x27;, undefined);
      const collation &#x3D; get(params, &#x27;requestBase.collation&#x27;, undefined);

      if (skip &lt; 1) {
        skip &#x3D; (page - 1) * limit;
      }

      if (isQueryAll(page, limit)) {
        // 兼容 0-0 查询所有
        skip &#x3D; 0;
        page &#x3D; 1;
      }
      return {
        page,
        limit,
        where,
        skip,
        populate,
        sort,
        collation,
      };
    } catch (e) {
      return {};
    }
  },
)</code>
                    </td>
                </tr>


        </tbody>
    </table>
</section>
    <h3>utils/mongo-crud/crud-config.ts</h3>
    <section data-compodoc="block-properties">
    <h3></h3>    <table class="table table-sm table-bordered">
        <tbody>
            <tr>
                <td class="col-md-4">
                    <a name="defaultPaginate"></a>
                    <span class="name">
                        <span ><b>defaultPaginate</b></span>
                        <a href="#defaultPaginate"><span class="icon ion-ios-link"></span></a>
                    </span>
                </td>
            </tr>
                <tr>
                    <td class="col-md-4">
                        <i>Type : </i>        <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/object" target="_blank" >object</a></code>

                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                        <i>Default value : </i><code>{
  records: &#x27;records&#x27;, // 数据
  total: &#x27;total&#x27;, // 总条数
  current: &#x27;current&#x27;, // 当前页
  pages: &#x27;pages&#x27;, // 总页数
  size: &#x27;size&#x27;, // 每页条数
}</code>
                    </td>
                </tr>


        </tbody>
    </table>
</section>
    <h3>utils/mongo-crud/index.ts</h3>
    <section data-compodoc="block-properties">
    <h3></h3>    <table class="table table-sm table-bordered">
        <tbody>
            <tr>
                <td class="col-md-4">
                    <a name="getMongoQueryParams"></a>
                    <span class="name">
                        <span ><b>getMongoQueryParams</b></span>
                        <a href="#getMongoQueryParams"><span class="icon ion-ios-link"></span></a>
                    </span>
                </td>
            </tr>
                <tr>
                    <td class="col-md-4">
                        <i>Default value : </i><code>async (
  params: ICrudBody,
  modal: Model&lt;{} | any&gt;,
): Promise&lt;ICrudQuery&gt; &#x3D;&gt; {
  let [page, limit] &#x3D; get(params, &#x27;requestBase.page&#x27;, &#x27;1-10&#x27;)
    ?.split(&#x27;-&#x27;)
    .map((item) &#x3D;&gt; parseInt(item)) ?? [1, 10];
  const where &#x3D; get(params, &#x27;data.where&#x27;, {});
  let skip &#x3D; get(params, &#x27;requestBase.skip&#x27;, 0);
  const populate &#x3D; get(params, &#x27;requestBase.populate&#x27;, undefined);
  const sort &#x3D; get(params, &#x27;requestBase.sort&#x27;, undefined);
  const collation &#x3D; get(params, &#x27;requestBase.collation&#x27;, undefined);

  if (skip &lt; 1) {
    skip &#x3D; (page - 1) * limit;
  }

  const total &#x3D; await modal.countDocuments(where);
  if (isQueryAll(page, limit)) {
    // 兼容 0-0 查询所有
    skip &#x3D; 0;
    limit &#x3D; total;
    page &#x3D; 1;
  }
  return {
    page,
    limit,
    where,
    skip,
    populate,
    sort,
    collation,
    total,
  };
}</code>
                    </td>
                </tr>


        </tbody>
    </table>
    <table class="table table-sm table-bordered">
        <tbody>
            <tr>
                <td class="col-md-4">
                    <a name="isQueryAll"></a>
                    <span class="name">
                        <span ><b>isQueryAll</b></span>
                        <a href="#isQueryAll"><span class="icon ion-ios-link"></span></a>
                    </span>
                </td>
            </tr>
                <tr>
                    <td class="col-md-4">
                        <i>Default value : </i><code>(page &#x3D; 1, limit &#x3D; 10) &#x3D;&gt; {
  return page &#x3D;&#x3D;&#x3D; 0 &amp;&amp; limit &#x3D;&#x3D;&#x3D; 0;
}</code>
                    </td>
                </tr>


        </tbody>
    </table>
</section>
    <h3>utils/common/index.ts</h3>
    <section data-compodoc="block-properties">
    <h3></h3>    <table class="table table-sm table-bordered">
        <tbody>
            <tr>
                <td class="col-md-4">
                    <a name="isExpiredToUpdatedAtISOS"></a>
                    <span class="name">
                        <span ><b>isExpiredToUpdatedAtISOS</b></span>
                        <a href="#isExpiredToUpdatedAtISOS"><span class="icon ion-ios-link"></span></a>
                    </span>
                </td>
            </tr>
                <tr>
                    <td class="col-md-4">
                        <i>Default value : </i><code>(
  current: string,
  record: string,
  expire &#x3D; 7200,
  offset &#x3D; 0,
) &#x3D;&gt; {
  // 将更新时间转换为日期对象
  const updatedAtDate &#x3D; new Date(record);
  // 计算过期时间戳
  const expiredTimestamp &#x3D;
    Date.parse(updatedAtDate) + expire * 1000 - offset * 1000;
  // console.log(&#x27;current&#x27;, current);
  // console.log(&#x27;Date.parse(current)&#x27;, Date.parse(current));
  // console.log(&#x27;expiredTimestamp&#x27;, expiredTimestamp);
  // 比较当前时间与过期时间戳
  return Date.parse(current) &gt; expiredTimestamp;
}</code>
                    </td>
                </tr>


        </tbody>
    </table>
</section>
    <h3>libs/db/src/db.module.ts</h3>
    <section data-compodoc="block-properties">
    <h3></h3>    <table class="table table-sm table-bordered">
        <tbody>
            <tr>
                <td class="col-md-4">
                    <a name="models"></a>
                    <span class="name">
                        <span ><b>models</b></span>
                        <a href="#models"><span class="icon ion-ios-link"></span></a>
                    </span>
                </td>
            </tr>
                <tr>
                    <td class="col-md-4">
                        <i>Default value : </i><code>TypegooseModule.forFeature([Feishu_Tenant, Post, Weapp])</code>
                    </td>
                </tr>


        </tbody>
    </table>
</section>
    <h3>src/feishu/store.ts</h3>
    <section data-compodoc="block-properties">
    <h3></h3>    <table class="table table-sm table-bordered">
        <tbody>
            <tr>
                <td class="col-md-4">
                    <a name="temp_test_content"></a>
                    <span class="name">
                        <span ><b>temp_test_content</b></span>
                        <a href="#temp_test_content"><span class="icon ion-ios-link"></span></a>
                    </span>
                </td>
            </tr>
                <tr>
                    <td class="col-md-4">
                        <i>Type : </i>        <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/object" target="_blank" >object</a></code>

                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                        <i>Default value : </i><code>{
  config: {
    wide_screen_mode: true,
  },
  elements: [
    {
      tag: &#x27;img&#x27;,
      img_key: &#x27;img_v2_041b28e3-5680-48c2-9af2-497ace79333g&#x27;,
      alt: {
        tag: &#x27;plain_text&#x27;,
        content: &#x27;&#x27;,
      },
      mode: &#x27;fit_horizontal&#x27;,
      preview: true,
    },
    {
      actions: [
        {
          tag: &#x27;button&#x27;,
          text: {
            content: &#x27;去处理&#x27;,
            tag: &#x27;plain_text&#x27;,
          },
          type: &#x27;primary&#x27;,
          multi_url: {
            url: &#x27;https://applink.feishu.cn/client/mini_program/open?appId&#x3D;cli_a5e43374e1e2900c&amp;path&#x3D;index&#x27;,
            pc_url: &#x27;&#x27;,
            android_url: &#x27;&#x27;,
            ios_url: &#x27;&#x27;,
          },
        },
      ],
      tag: &#x27;action&#x27;,
    },
  ],
  header: {
    template: &#x27;turquoise&#x27;,
    title: {
      content: &#x27;你有一条新的任务待处理&#x27;,
      tag: &#x27;plain_text&#x27;,
    },
  },
  card_link: {
    url: &#x27;https://applink.feishu.cn/client/mini_program/open?appId&#x3D;cli_a5e43374e1e2900c&amp;mode&#x3D;slide&amp;path&#x3D;index&#x27;,
    pc_url: &#x27;&#x27;,
    android_url: &#x27;&#x27;,
    ios_url: &#x27;&#x27;,
  },
}</code>
                    </td>
                </tr>


        </tbody>
    </table>
</section>



                   </div><div class="search-results">
    <div class="has-results">
        <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
        <ul class="search-results-list"></ul>
    </div>
    <div class="no-results">
        <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
    </div>
</div>
</div>
               <!-- END CONTENT -->
           </div>
       </div>

          <label class="dark-mode-switch">
               <input type="checkbox">
               <span class="slider">
                    <svg class="slider-icon" viewBox="0 0 24 24" fill="none" height="20" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" width="20" xmlns="http://www.w3.org/2000/svg">
                    <path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
                    </svg>
               </span>
          </label>

       <script>
            var COMPODOC_CURRENT_PAGE_DEPTH = 1;
            var COMPODOC_CURRENT_PAGE_CONTEXT = 'miscellaneous-variables';
            var COMPODOC_CURRENT_PAGE_URL = 'variables.html';
            var MAX_SEARCH_RESULTS = 15;
       </script>

       <script src="../js/libs/custom-elements.min.js"></script>
       <script src="../js/libs/lit-html.js"></script>

       <script src="../js/menu-wc.js" defer></script>
       <script nomodule src="../js/menu-wc_es5.js" defer></script>

       <script src="../js/libs/bootstrap-native.js"></script>

       <script src="../js/libs/es6-shim.min.js"></script>
       <script src="../js/libs/EventDispatcher.js"></script>
       <script src="../js/libs/promise.min.js"></script>
       <script src="../js/libs/zepto.min.js"></script>

       <script src="../js/compodoc.js"></script>

       <script src="../js/tabs.js"></script>
       <script src="../js/menu.js"></script>
       <script src="../js/libs/clipboard.min.js"></script>
       <script src="../js/libs/prism.js"></script>
       <script src="../js/sourceCode.js"></script>
          <script src="../js/search/search.js"></script>
          <script src="../js/search/lunr.min.js"></script>
          <script src="../js/search/search-lunr.js"></script>
          <script src="../js/search/search_index.js"></script>
       <script src="../js/lazy-load-graphs.js"></script>


    </body>
</html>
